/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import me.zhengjie.aop.domain.BisLog;
import me.zhengjie.base.BaseBusiness;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-04-15
**/
@Entity
@Data
@Table(name="BIS_MSG")
public class Msg implements Serializable {

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "BIS_MSG_ID")
    @ApiModelProperty(value = "主键ID")
    private String bisMsgId;

    @Column(name = "YWLX")
    @ApiModelProperty(value = "业务类型")
    private String ywlx;

    @Column(name = "LRR")
    @ApiModelProperty(value = "录入人")
    private Long lrr;

    @Column(name = "LRRXM")
    @ApiModelProperty(value = "录入人姓名")
    private String lrrxm;

    @Column(name = "LRBM")
    @ApiModelProperty(value = "录入人部门")
    private Long lrbm;

    @Column(name = "LRBMMC")
    @ApiModelProperty(value = "录入人部门名称")
    private String lrbmmc;

    @Column(name = "LRSJ")
    @ApiModelProperty(value = "录入时间")
    private Timestamp lrsj;

    @Column(name = "GXR")
    @ApiModelProperty(value = "更新人")
    private Long gxr;

    @Column(name = "GXRXM")
    @ApiModelProperty(value = "更新人姓名")
    private String gxrxm;

    @Column(name = "GXBM")
    @ApiModelProperty(value = "更新人部门")
    private Long gxbm;

    @Column(name = "GXBMMC")
    @ApiModelProperty(value = "更新人部门名称")
    private String gxbmmc;

    @Column(name = "GXSJ")
    @ApiModelProperty(value = "更新时间")
    private Timestamp gxsj;

    @Column(name = "SFYX")
    @ApiModelProperty(value = "是否有效")
    private String sfyx;

    @Column(name = "BZ")
    @ApiModelProperty(value = "备注")
    private String bz;

    @Column(name = "TYPE")
    @ApiModelProperty(value = "消息类型")
    private String type;
    @Column(name = "SEND_TIME")
    @ApiModelProperty(value = "发送时间")
    private Timestamp sendTime;
    @Column(name = "STATUS")
    @ApiModelProperty(value = "发送状态")
    private String status;
    @Column(name = "TIMES")
    @ApiModelProperty(value = "发送次数")
    private Integer times;
    @Column(name = "CONTENT")
    @ApiModelProperty(value = "发送内容")
    private String content;
    @Column(name = "TARGET")
    @ApiModelProperty(value = "发送目标")
    private String target;
    @Column(name = "ERROR_MSG")
    @ApiModelProperty(value = "失败信息")
    private String errorMsg;


    public void copy(Msg source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    @Override
    public int hashCode() {
        return Objects.hash(bisMsgId);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Msg msg = (Msg) o;
        return bisMsgId.equals(msg.bisMsgId);
    }
}